package com.hiwetop.proxy;

import com.fj.hiwetoptools.http.HttpConnection;
import com.fj.hiwetoptools.http.HttpResponse;
import com.fj.hiwetoptools.http.Method;

import java.net.InetSocketAddress;
import java.net.Proxy;

/**
 * Created by linyu on 2016/12/29.
 */
public class ProxyUrl {
    public static void main(String[] args) {
        Proxy proxy = new Proxy(Proxy.Type.HTTP, new InetSocketAddress("127.0.0.1", 1080));
        HttpConnection http = HttpConnection.create("https://www.baidu.com", Method.GET);
        http.setProxy(proxy);
        HttpResponse httpResponse = HttpResponse.readResponse(http);
        String result = httpResponse.body();
        System.out.println(result);
    }
}
